const obj = {}
Object.defineProperty(obj, 'age', {
    value: 18,  // value没有定义返回undefined
    //writable、enumerable、configurable不写默认false
    writable: true,  //是否可以被修改
    enumerable: true,  //是否可以被枚举
    configurable: false  //是否可以删除、添加属性

})
console.log(obj.age)
obj.age = 20
console.log(obj.age)
console.log(Object.values(obj))
delete obj.age
console.log(obj.age)
Object.defineProperty(obj, 'age', {
    value: 25
})
console.log(obj)
console.log('____________________________________________')

const obj_test = {}
let number = 18
Object.defineProperty(obj_test, 'age', {
    // enumerable:true,
    get() {
        return number
    },
    set(newValue) {
        number = newValue
    }
})
console.log(obj_test.age, 'obj_test')
obj_test.age = 20
console.log(Object.keys(obj_test), 'obj_test')
console.log(obj_test.age, 'obj_test')